package com.kk.blog.config;

import com.kk.blog.interceptor.loginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    public void addInterceptors (InterceptorRegistry registry) {
        registry.addInterceptor(new loginInterceptor( ))
                .addPathPatterns("/admin/**")
                .excludePathPatterns("/admin/login")    //放行的页面
                .excludePathPatterns("/admin")          //放行的页面
                ;

    }
}
